<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>    
    <title><?php echo $title; ?></title>    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
    <base href="<?php echo $base; ?>" />
    <?php if ($icon) { ?>
        <link href="<?php echo $icon; ?>" rel="icon" />
    <?php } ?>      
    
    <link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $template; ?>/css/style.css" />   
    <link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $template; ?>/css/jquery.simplemodal.css" />    

    <script type="text/javascript" src="catalog/view/theme/<?php echo $template; ?>/js/jquery.js"></script>     
    <script type="text/javascript" src="catalog/view/theme/<?php echo $template; ?>/js/jquery.simplemodal.js"></script> 
    <script type="text/javascript" src="catalog/view/theme/<?php echo $template; ?>/js/simplemodal.formstyle.js"></script>
</head>
<body>
    <div id="page_newsletter">
	    <div id="page_bg_newsletter">	 
            <!-- begin: #Header -->
            <div id="header">
	            <p style="text-align: center" class="p10t"><a href="<?php echo $home; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/logo.png"/></a></p>	            
            </div>
            <!-- end: #Header -->
            <!-- begin: #Main -->
            <div id="main">
                <div id="main_newsletter">                                   
                    <div class="p15t p20r p15b p20l">                        
                        <div class="newsletter_page">
                            <h3>Nyhedsbrev</h3>
                            <p>
                                Tilmeld dig vores nyhedsbrev og få 5% i rabat på alle onlinekøb. Vi udsender nyhedsbrev 1-2 gange om måneden.
                            </p>
                            <form id="newsletterForm" method="post" action="<?php echo str_replace('&', '&amp;', $action); ?>">
                                <fieldset>
                                    <input type="text" id="subscriber_name" class="input-txt input-mg" name="subscriber_name" value="Indtast din navn" title="Indtast din navn" /><div class="float_left">&nbsp;</div>
                                    <input type="text" id="subscriber_email" class="input-txt" name="subscriber_email" value="Indtast din email-adresse" title="Indtast din email-adresse" />
                                    <a id="subscriber_button" class="submit-btn" name="subscriber" href="">Tilmeld</a>
                                    <a id="unsubscriber_button" class="submit-btn" href="">Afmeld</a>
                                </fieldset>
                            </form>                       
                        </div>
                    </div>
                </div>
            </div>              
            <!-- end: #Main -->
            <!-- begin: #Footer -->
            <div id="footer_newsletter">
                <div class="footer_newsletter_content">
                    <p class="float_left">Copyright &copy; 2012 <a target="_blank" href="http://www.jyskvvs.dk">havhokeren.dk</a>. All rights reserved.</p>
                    <p class="float_right">Design by <a target="_blank" href="http://mwc.com.vn">My Web Creations</a></p>
                    <br class="cb">
                </div>
            </div>
            <!-- end: #Footer -->
        </div>
    </div>
    
    <!-- Dialog -->
    <div id="confirm">
        <div class="header"><span>Confirm</span></div>
        <div class="message"></div>                   
        <div class="buttons">
            <div class="continue" id="button_continue">Fortsæt</div> 
            <div class="no simplemodal-close" id="button_no">Ingen</div>
            <div class="yes" id="button_yes">Ja</div>                  
        </div>
    </div>   
  
    <script type="text/javascript" src="catalog/view/theme/<?php echo $template; ?>/js/havh.js" ></script>
    <script type="text/javascript">
        //var mail_filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;     	
        var mail_filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z]{2,6})+$/;
        
        jQuery('#subscriber_button').live('click', function(event){
            event.preventDefault();
            
            if((jQuery('#subscriber_name').val() == '') || (jQuery('#subscriber_name').val() == jQuery('#subscriber_name').attr('title'))){  			
                confirm('Nyhedsbreve', 'Navn er ugyldig. Indtast en gyldig navn.', 'notify');
                setTimeout("jQuery('.simplemodal-close').click()", 90000);	
                return false;
            }
        
            if(!mail_filter.test(jQuery('#subscriber_email').val())){  
                //confirm('Nyhedsbreve', 'E-mail "' + jQuery('#subscriber_email').val() + '" er ugyldig. <br />Indtast en gyldig e-mail-adresse!', 'notify');
                confirm('Nyhedsbreve', 'E-mailen er ugyldig. Indtast en gyldig e-mail.', 'notify');
                setTimeout("jQuery('.simplemodal-close').click()", 90000);	
                return false;
            }
            
            jQuery.post(
                "<?php echo $subscriber_url; ?>", 
                {'email': jQuery('#subscriber_email').val(), 'name': jQuery('#subscriber_name').val()},
                function(data){    			    
                    confirm('Nyhedsbreve', data, 'notify');                
                    setTimeout("jQuery('.simplemodal-close').click()", 90000);
                    jQuery('#subscriber_email').focus();
                }
            );
            jQuery('#subscriber_email').val('');
            jQuery('#subscriber_name').val('');
            
            return false;
        });
        
        jQuery('#unsubscriber_button').live('click', function(event){
            event.preventDefault();
            
            if(!mail_filter.test(jQuery('#subscriber_email').val())){  
                //confirm('Nyhedsbreve', 'E-mail "' + jQuery('#subscriber_email').val() + '" er ugyldig. <br />Indtast en gyldig e-mail-adresse!', 'notify');
                confirm('Nyhedsbreve', 'E-mailen er ugyldig. Indtast en gyldig e-mail.', 'notify');
                setTimeout("jQuery('.simplemodal-close').click()", 90000);    
                return false;
            }
            
            jQuery.post(
                "<?php echo $unsubscriber_url; ?>", 
                {email: jQuery('#subscriber_email').val()},
                function(data){                    
                    confirm('Nyhedsbreve', data, 'notify');                
                    setTimeout("jQuery('.simplemodal-close').click()", 90000);
                    jQuery('#subscriber_email').focus();
                }
            );
            jQuery('#subscriber_email').val('');
            jQuery('#subscriber_name').val('');
            
            return false;  
        });
    </script>
</body> 